package com.naiterui.ehp.bs.doctor.vo.medicine;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.naiterui.ehp.bp.utils.lang.ConfigUtil;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel(value = "MedicineCustomCycleUnitVO", description = "用药周期自定义单位对应值")
public class MedicineCustomCycleUnitVO implements Serializable {

    /**
     * 字段或域定义：<code>serialVersionUID</code>
     */
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "周期单位")
    private String customCycleDateUnit;

    @ApiModelProperty(value = "代表天数")
    private Integer baseNumber;

    public String getCustomCycleDateUnit() {
        return this.customCycleDateUnit;
    }

    public void setCustomCycleDateUnit(String customCycleDateUnit) {
        this.customCycleDateUnit = customCycleDateUnit;
    }

    public Integer getBaseNumber() {
        return this.baseNumber;
    }

    public void setBaseNumber(Integer baseNumber) {
        this.baseNumber = baseNumber;
    }

    public static List<MedicineCustomCycleUnitVO> toVOList() {
        List<MedicineCustomCycleUnitVO> list = new ArrayList<>();
        String cycleUnitList = ConfigUtil.getString("init.medinice.custom.cycleUnitList");
        String[] strArray = cycleUnitList.split(",");
        for (String aStrArray : strArray) {
            MedicineCustomCycleUnitVO vo = new MedicineCustomCycleUnitVO();
            String[] str = aStrArray.split("-");
            vo.setCustomCycleDateUnit(str[0]);
            vo.setBaseNumber(Integer.parseInt(str[1]));
            list.add(vo);
        }
        return list;
    }

}
